home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
smaltalk
/
stv.lha
/
STV
/
st_v
/
util
/
STVUTIL4.ZIP
/
NOECHO.ST
< prev
next >
Wrap
Text File
|
1993-02-07
|
4KB
|
107 lines
!Copyright 1990 Digitalk, Inc. May be used freely under the same
terms and conditions as contained in the Digitalk License Statement.
This code is provided on an as-is basis, and all warrenties, either
express or implied, are disclaimed.
======================================================="!
"This is for Smalltalk/V and Smalltalk/V 286"!
NoEcho := false !
StringModel subclass: #NoEchoStringModel
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: '' !
! NoEchoStringModel methods !
display: aRectangle
"Display the text contained in aRectangle."
| sourceY dest lastY sourceX minY fontSize dummyChar |
dummyChar := $(.
fontSize := charScanner font charSize.
sourceX := aRectangle origin x.
sourceY := aRectangle origin y.
lastY := aRectangle corner y.
dest := aRectangle origin - lastChild topCorner *
charScanner font charSize.
lines size >= sourceY ifTrue: [
(sourceY = lastY) ifTrue: [ "single line"
charScanner
display: ((String new: (lines at: sourceY) size) atAllPut: dummyChar)
from: sourceX
to: aRectangle corner x
at: dest.
^self].
"display first line for multi lines"
charScanner
display: ((String new: (lines at: sourceY) size) atAllPut: dummyChar)
from: sourceX
at: dest].
minY := lastY min: lines size.
sourceY + 1 to: minY do: [ :i |
dest := 0 @ (dest y + fontSize y).
charScanner
display: ((String new: (lines at: i) size) atAllPut: dummyChar)
from: lastChild topCorner x
at: dest].
minY < lastY
ifTrue: [
minY := minY max: sourceY - 1. "for
case sourceY > minY"
charScanner
blankRestFrom:
(minY - lastChild topCorner y + 1
* fontSize y)] ! !
! Prompter methods !
prompt: questionString default: answerString
"Private - Initialize a Prompter window
and give it control."
| topPane promptBox tempOffset offset cursor |
cursor := Cursor.
CursorManager normal change.
reply := answerString.
exitBlock := [
cursor change.
^reply].
topPane := TopPane new
label: questionString;
leftIcons: Array new;
rightIcons: Array new;
backColor: 14;
minimumSize:
((questionString size max: reply size) + 4
* (LabelFont width max: TextFont width)
min: 60 * SysFontWidth)
@ (LabelFont height + TextFont height + 10);
yourself.
topPane addSubpane:
(replyPane := TextPane new
model: self;
menu: #menu;
dispatcher: PromptEditor new;
name: #reply;
change: #acceptReply:from:;
framingBlock: [:box|
box origin corner: box corner]).
NoEcho ifTrue: [replyPane textHolder: (NoEchoStringModel for: '')].
offset := Cursor offset.
promptBox :=
Rectangle
origin: offset
extent: topPane minimumSize.
tempOffset := (Display extent - promptBox extent)
min: (offset - (4 @ (SysFontHeight * 2)) max: 0 @ 0).
promptBox moveTo: tempOffset.
"topPane unzoom."
hiddenArea := Display compatibleForm fromDisplay: promptBox.
hiddenArea offset: tempOffset.
topPane dispatcher openIn: promptBox.
replyPane
selectAtEnd;
homeCursor.
topPane activateWindow.
[topPane dispatcher active] whileTrue: [
replyPane dispatcher processInput] ! !